package com.example.demo.configuration

import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter

@Configuration
class ResourceConfig : WebMvcConfigurerAdapter() {

    private val log = LoggerFactory.getLogger(ResourceConfig::class.java)!!

    @Value("\${picture.dir}")
    private val mImagePath = ""

    override fun addResourceHandlers(registry: ResourceHandlerRegistry) {
        registry.addResourceHandler("/images/**").addResourceLocations(mImagePath)
        super.addResourceHandlers(registry)
    }

}